package com.mx.tool.window;

import com.intellij.openapi.components.ServiceManager;
import com.intellij.openapi.project.Project;
import com.intellij.openapi.wm.ToolWindow;
import com.intellij.openapi.wm.ToolWindowFactory;
import com.intellij.ui.content.Content;
import com.intellij.ui.content.ContentFactory;
import com.mx.tool.form.window.MxToolWindow;
import org.jetbrains.annotations.NotNull;

/**
 * @Author: mengxiang.
 * @create: 2021-11-09 10:09
 * @Description: 主页面初始化
 */
public class MxToolWindowFactory implements ToolWindowFactory {

    public static Project PROJECT;


    @Override
    public void createToolWindowContent(@NotNull Project project, @NotNull ToolWindow toolWindow) {
        PROJECT = project;
        MxToolWindow myToolWindow = new MxToolWindow(toolWindow);
        ContentFactory contentFactory =  ServiceManager.getService(ContentFactory.class);
        Content content = contentFactory.createContent(myToolWindow.getContent(), "", false);
        toolWindow.getContentManager().addContent(content);
    }
}
